import type { QuickEntryParams } from '@/types/quickEntry'
import { defineStore } from 'pinia'
import { ref } from 'vue'

const useConsultStore = defineStore(
  'consult',
  () => {
    const illnessInfo = ref<
      Pick<
        QuickEntryParams,
        | 'illnessDesc'
        | 'illnessTime'
        | 'consultFlag'
        | 'pictures'
        | 'type'
        | 'illnessType'
        | 'depId'
      >
    >({
      illnessDesc: '',
      illnessTime: 1,
      consultFlag: 0,
      pictures: [],
      type: 0,
      illnessType: 0,
      depId: '',
    })
    const patientId = ref('')
    const orderId = ref('')
    const clear = () => {
      illnessInfo.value = {
        illnessDesc: '',
        illnessTime: 1,
        consultFlag: 0,
        pictures: [],
        type: 0,
        illnessType: 0,
        depId: '',
      }
      patientId.value = ''
      orderId.value = ''
    }
    return { illnessInfo, patientId, orderId, clear }
  },
  { persist: true }
)

export default useConsultStore
